{template 'common/header'}
<style>
.module .thumbnails li{}
</style>
<div class="main">
		<div class="module">
			<div class="row-fluid">
				<ul class="thumbnails">
				{loop $modulelist $row}
				<li style="width:23.6%; min-width:240px;">
					<div class="thumbnail">
						<div class="module-pic">
							<img src="./source/modules/{php echo strtolower($row['name']);}/preview.jpg" onerror="this.src='./resource/image/module-nopic-big.jpg'" {if !$row['enabled']}class="gray"{/if}>
							<div class="module-detail">
								<h5 class="module-title">{$row['title']}<small>（标识：{$row['name']}）</small></h5>
								<p class="module-brief">{$row['ability']}</p>
								<p class="module-description">{$row['description']} {if $row['isrulefields']}<a href="{php echo create_url('rule/post', array('module' => $row['name']))}" class="text-info">添加规则</a>{/if}</p>
							</div>
						</div>
						<div class="module-button">
							{if $row['issystem']}
								<a href="javascript:;" class="pull-right"><span>此模块为系统模块</span></a>
							{else}
							{if $row['enabled']}
								<a id="enabled_{$row['mid']}_0" href="{php echo create_url('member/module/enable', array('mid' => $row['mid'], 'enabled' => 0))}" onclick="return ajaxopen(this.href)" class="btn btn-primary module-button-switch">禁用</a>
							{else}
								<a id="enabled_{$row['mid']}_1" href="{php echo create_url('member/module/enable', array('mid' => $row['mid'], 'enabled' => 1))}" onclick="return ajaxopen(this.href);" class="btn btn-danger module-button-switch">启用</a>
							{/if}
							{/if}
							{if $row['enabled'] && !$row['issystem']}
								{if $row['shortcut']}
								<a href="{php echo create_url('member/module/shortcut', array('mid' => $row['mid'], 'shortcut' => 0))}" onclick="return ajaxopen(this.href);" class="btn btn-danger">移出快捷操作</a>
								{else}
								<a href="{php echo create_url('member/module/shortcut', array('mid' => $row['mid'], 'shortcut' => 1))}" onclick="return ajaxopen(this.href);" class="btn">加入快捷操作</a>
								{/if}
							{/if}
							{if $row['settings'] && $row['enabled']}
								<a href="{php echo create_url('member/module/setting', array('mid' => $row['mid']))}" class="btn module-button-switch">设置</a>
							{/if}
						</div>
					</div>
				</li>
				{/loop}
			</div>
			<div>
				{$pager}
			</div>
		</div>
		<!-- The End -->
	</div>
</div>
	<script type="text/javascript">
		function toggle_description(id) {
			var container = $('#'+id).parent().parent().parent();
			var status = $('#'+id).attr("status");
			if(status == 1) {
				$('#'+id).attr("status", "0")
				container.find(".module_description").show();
			} else {
				$('#'+id).attr("status", "1")
				container.find(".module_description").hide();
			}
		}
		$(function() {
			$('.module .thumbnails').delegate('li .module-button-switch', 'click', function(){ //控制模块开关
				if($(this).hasClass('btn-primary')) { //禁用模块
					$(this).removeClass('btn-primary').addClass('btn-danger').html('开启');
				} else if($(this).hasClass('btn-danger')) { //开启模块
					$(this).removeClass('btn-danger').addClass('btn-primary').html('禁用');
				}
				$(this).parent().parent().find('.module-pic img').toggleClass('gray');
			});
			$('.module .thumbnails').delegate('li', 'hover', function(){ //控制模块详细信息
				$(this).find('.module-title,.module-brief').toggle();
				$(this).find('.module-description').toggle('fast');
			});
		});
	</script>
{template 'common/footer'}
